package com.hxtec.polaris.pay.wx;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.InputStream;

/**
 * @Author Marcus lv
 * @create 2019/12/6 3:32 下午
 */
@Component
public class WXPayRealConfig extends WXPayConfig {
    @Value(value = "${pay.appid}")
    private String appid;
    @Value(value = "${pay.mchId}")
    private String mchId;
    @Value(value = "${pay.key}")
    private String key;
    @Value(value = "${pay.secret}")
    private String secret;

    @Override
    public String getAppID() {
        return this.appid;
    }

    @Override
    public String getMchID() {
        return this.mchId;
    }

    @Override
    public String getKey() {
        return key;
    }

    public String getSecret() {
        return secret;
    }

    @Override
    public  InputStream getCertStream() {
        return null;
    }

    @Override
    IWXPayDomain getWXPayDomain() {
        return new IWXPayDomain() {
            @Override
            public void report(String domain, long elapsedTimeMillis, Exception ex) {

            }

            @Override
            public DomainInfo getDomain(WXPayConfig config) {
                return new DomainInfo("api.mch.weixin.qq.com",true);
            }
        };
    }
}
